<!DOCTYPE html>
<html xmlns:th="http:www.thymeleaf.org">

<head>
<meta charset="UTF-8">
<title>管理员信息修改</title>
<!---引入jquery资源--->
<script type="text/javascript"
	th:src="@{static/bootstrap-3.3.7-dist/js/jquery.min.js}"></script>
<!--引入bootstrap的核心js资源文件--->
<script type="text/javascript"
	th:src="@{static/bootstrap-3.3.7-dist/js/bootstrap.min.js}"></script>
<!--引入bootstrap的核心css资源文件--->
<link rel="stylesheet" type="text/css"
	th:href="@{static/bootstrap-3.3.7-dist/css/bootstrap.min.css}" />
<script type="text/javascript">
	// 绑定隐藏按钮的点击事件
	$(function() {
		$("#btnUpdate").on("click",doAjaxSaveOrUpdate);
	});
	function doAjaxSaveOrUpdate() {
		$.ajax({
			// 请求类型
			type : "POST",
			// 服务器url
			url : "/doAjaxSaveOrUpdate",
			// 发送的数据
			data : $("#formModify").serialize(),
			// responseText转换的数据类型为json对象类型
			//dataType : "json",
			// 成功之后回调方法，方法的参数是服务器响应的内容也就是ajax引擎获取到responseText内容
			success : function(data, textStatus, jqXHR) {
				console.info("ajax:");
				console.info(data);
				// 保存成功之后，关闭layer弹出层
				//当你在iframe页面关闭自身时
				var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
				parent.layer.close(index); //再执行关闭 
			},
			error : function() {
				alert("error...");
			}
		});
	}
</script>
</head>

<body style="width: 95%">
	<form id="formModify" class="form-horizontal"
		action="/doAdminInfoAdd" method="post">
		<div class="form-group">
			<!-- 隐藏表单域：将修改数据的id发回到后台进行修改保存 -->
			<input type="hidden" id="adminId" name="adminid"
				th:value="${session.adminB.adminid }">
		</div>
		<div class="form-group">
			<label for="txtName" class="col-sm-2 control-label">用户名</label>
			<div class="col-sm-3">
				<input type="text" class="form-control" id="adminName"
					name="adminname2" th:value="${session.adminB.adminname2 }"
					placeholder="请输入用户名">
			</div>
			<label for="txtPsw" class="col-sm-2 control-label">密码</label>
			<div class="col-sm-3">
				<input type="password" class="form-control" id="adminPsw"
					name="adminpsw" th:value="${session.adminB.adminpsw }"
					placeholder="请输入密码">
			</div>
		</div>
		<div class="form-group">
			<label for="txtEmail" class="col-sm-2 control-label">邮箱</label>
			<div class="col-sm-3">
				<input type="email" class="form-control" id="adminEmail"
					name="adminemail" th:value="${session.adminB.adminemail }"
					placeholder="请输入邮箱">
			</div>
			<label for="txtSex" class="col-sm-2 control-label">性别</label>
			<div class="col-sm-3">
				<label class="radio-inline"> <input type="radio"
					name="amdinsex" id="amdinSex1"
					th:checked="${session.adminB.amdinsex == '男' }"					
					value="男"> 男
				</label> <label class="radio-inline"> <input type="radio"
					name="amdinsex" id="amdinSex2"
					th:checked="${session.adminB.amdinsex == '女' }"
					value="女"> 女
				</label>
			</div>
		</div>
		<div class="form-group">
			<label for="txtName" class="col-sm-2 control-label">电话</label>
			<div class="col-sm-3">
				<input type="text" class="form-control" id="adminTel"
					name="admintel" th:value="${session.adminB.admintel }"
					placeholder="请输入电话">
			</div>
			<label for="txtPsw" class="col-sm-2 control-label">年龄</label>
			<div class="col-sm-3">
				<input type="text" class="form-control" id="amdinAge"
					name="amdinage" th:value="${session.adminB.amdinage }"
					placeholder="请输入年龄">
			</div>
		</div>
		<div class="form-group">
			<label for="txtName" class="col-sm-2 control-label">创建日期</label>
			<div class="col-sm-3">
				<input type="date" class="form-control" id="adminCreateTime"
					name="admincreatetime"
					 th:value="${#dates.format(session.adminB.admincreatetime, 'yyyy-MM-dd')}"
					placeholder="请输入创建时间">
			</div>
		</div>
		<button id="btnUpdate" style="display: none" type="button"></button>
		<!-- <div class="form-group">
				<div class="col-sm-offset-4 col-sm-1">
					<button type="submit" class="btn btn-default" >修&nbsp;&nbsp;改</button>
				</div>
				<div class="col-sm-offset-1 col-sm-1">
					<button type="reset" class="btn btn-default">取&nbsp;&nbsp;消</button>
				</div>
			</div> -->
	</form>
</body>
</html>